// src/router/index.js
import { createRouter, createWebHistory } from "vue-router";
import Login from "@/views/login.vue"; // 登录页
import Register from "@/views/register.vue"; // 注册页
import Home from "@/views/home.vue"; // 首页组件
import ShopIndex from '@/views/shop/index.vue' // 店铺信息组件
import User from "@/views/user/index.vue"; // 个人中心组件
import Detail from "@/views/shop/shopservices/index.vue";
import UserInfo from "@/views/user/profile/index.vue";// 用户个人信息组件
import UserOrder from '@/views/user/order/index.vue'; // 用户个人订单组件
import UserAppointed from '@/views/user/appointed/index.vue'; // 用户个人预约组件
import UserIntegral from '@/views/user/integral/index.vue'; // 用户个人积分余额组件
import UserCoupon from '@/views/user/coupon/index.vue'; // 用户个人优惠券包组件
import UserMember from '@/views/user/member/index.vue'; // 用户个人会员组件
const routes = [
  { path: "/", component: Home },
  { path: "/login", component: Login },
  { path: "/register", component: Register },
  { path: "/shop/index", component: ShopIndex },
  {
    path: "/detail/:id", // 使用动态参数
    name: "Detail",
    component: Detail,
  },
  {
    path: "/user",
    component: User,
    redirect: "/user/userInfo",
    children: [
      {
        path: "userInfo",
        component: UserInfo,
        name: "UserInfo",
      },
      {
        path: "myOrder",
        component: UserOrder,
        name: "UserOrder",
      },
      {
        path: "myAppointed",
        component: UserAppointed,
        name: "UserAppointed",
      },
      {
        path: "myIntegral",
        component: UserIntegral,
        name: "UserIntegral",
      },
      {
        path: "myCoupon",
        component: UserCoupon,
        name: "UserCoupon",
      },
      {
        path: "myMember",
        component: UserMember,
        name: "UserMember",
      },
    ],
  },
  {
    path: "/serviceDetail",
    component: () => import("@/views/service/ServiceDetail.vue"),
    name: "ServiceDetail",
  },
  {
    path: "/searchPage",
    component: () => import("@/views/searchContent/SearchPage.vue"),
    name: "SearchPage",
  },
  {
    path: "/shopDetail",
    component: () => import("@/views/shop/ShopDetail.vue"),
    name: "ShopDetail",
  },
  {
    path: "/employeeDetail",
    component: () => import("@/views/employee/EmployeeDetails.vue"),
    name: "EmployeeDetail",
  },
  {
    path: "/activityDetail",
    component: () => import("@/views/activity/ActivityDetails.vue"),
    name: "ActivityDetail",
  },
  // 添加更多路由
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
